﻿//*************************************************************************************
// File     : login.js
// Requires : jquery.js (version 1.2.6+)
// Author   : Kyle Weems (ksw)
// Origin   : mindfly.com
// Created  : August 19, 2009
// Modified : August 19, 2009
// Purpose  : Script for login page's animation.
//*************************************************************************************

var usernameImage = '';
var passwordImage = '';

$(document).ready(function() {
    $(document).pngFix();
    loginTextBackgrounds();
    logoAnimation();
});

function logoAnimation() {
    $('.logo').fadeIn(2500);
    $('.flare').animate({ top: '-53px' }, 2000, 'swing', function() { $('.subheader').fadeIn(1000); });
}

function loginTextBackgrounds() {
    usernameImage = $('#loginDetails input[type="text"]').css('background-image');
    passwordImage = $('#loginDetails input[type="password"]').css('background-image');
    if ($('#loginDetails input[type="text"]').attr('value') != '') {
        $('#loginDetails input[type="text"]').css('background-image', 'none');
    }
    if ($('#loginDetails input[type="password"]').attr('value') != '') {
        $('#loginDetails input[type="password"]').css('background-image', 'none');
    }    
    $('#loginDetails input[type="text"]').focus(function() { $('#loginDetails input[type="text"]').css('background-image', 'none'); })
    $('#loginDetails input[type="text"]').blur(function() {
        if ($('#loginDetails input[type="text"]').attr('value') == '') {
            $('#loginDetails input[type="text"]').css('background-image', usernameImage);            
        }
    });    $('#loginDetails input[type="password"]').focus(function() { $('#loginDetails input[type="password"]').css('background-image', 'none'); })
    $('#loginDetails input[type="password"]').blur(function() {
    if ($('#loginDetails input[type="password"]').attr('value') == '') {
        $('#loginDetails input[type="password"]').css('background-image', passwordImage);
        }
    });
}